package com.ruicar.afs.cloud.workflow.gwt.processor;

import com.alibaba.fastjson.JSON;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.request.FlowExceptionRequest;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.request.TaskAssignRequest;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.request.TaskCreateRequest;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.request.UpdateBizDataRequest;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.response.FlowExceptionResponse;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.response.TaskAssignResponse;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.response.TaskCreateResponse;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.response.UpdateBizDataResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

@Component
@Slf4j
@AllArgsConstructor
public class DefaultAfsWorkFLowNoticeProcess implements AfsWorkFlowNoticeProcessor {
    @Override
    public List<String> afsFLowKeys() {
        return Arrays.asList(new String[]{"default"});
    }

    @Override
    public TaskCreateResponse taskCreated(TaskCreateRequest taskCreateRequest) {
        log.info("接收到任务创建通知:{}", JSON.toJSONString(taskCreateRequest));
        TaskCreateResponse response = new TaskCreateResponse();
        response.setSuccess(true);
        return response;
    }

    @Override
    public TaskAssignResponse taskAssigned(TaskAssignRequest taskAssignRequest) {
        log.info("接收到任务分配通知:{}", JSON.toJSONString(taskAssignRequest));
        TaskAssignResponse response = new TaskAssignResponse();
        response.setSuccess(true);
        return response;
    }

    @Override
    public UpdateBizDataResponse updateBizData(UpdateBizDataRequest updateBizDataRequest) {
        log.info("接收到更新业务通知:{}", JSON.toJSONString(updateBizDataRequest));
        UpdateBizDataResponse response = new UpdateBizDataResponse();
        response.setSuccess(true);
        return response;
    }
}
